<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改服务预约信息')" />
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-reservation-edit" th:object="${reservation}">
            <input name="id" th:field="*{id}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">服务：</label>
                    <div class="col-sm-8">
                        <select name="supplyId" id="supplyId" class="form-control" required>
                            <!-- 商品选项将通过 JavaScript 动态填充 -->
                            <option th:each="petSupply:${petSupplyList}" th:value="${petSupply.id}" th:text="${petSupply.name}" th:selected="${petSupply.id == reservation.supplyId}"></option>
                        </select>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">客户姓名：</label>
                    <div class="col-sm-8">
                        <input name="customerName" th:field="*{customerName}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">宠物品种：</label>
                    <div class="col-sm-8">
                        <input name="petName" th:field="*{petName}" class="form-control" type="text" required>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">联系电话：</label>
                    <div class="col-sm-8">
                        <input name="contactNumber" th:field="*{contactNumber}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label is-required">预约时间：</label>
                    <div class="col-sm-8">
                        <div class="radio-box" th:each="dict : ${@dict.getType('time_type')}">
                            <input type="radio" th:id="${'appointmentTime_' + dict.dictCode}" name="appointmentTime" th:value="${dict.dictValue}" th:field="*{appointmentTime}" required>
                            <label th:for="${'appointmentTime_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <script th:inline="javascript">
        var prefix = ctx + "system/reservation";
        $("#form-reservation-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-reservation-edit').serialize());
            }
        }
    </script>
</body>
</html>